<!--
  * 时间：2024/11/29
  * 作者：刘岩
  * 描述：客流统计
-->
<template>
  <div class="flow-statistics">
<!--    <div class="my-echarts" ref="myEcharts"></div>-->
    <div class="left">
      <span class="num">{{ form.todayNum }}人</span>
      <img class="left-img" src="@/assets/large/guest.png" alt="">
      <span>今日客流统计</span>
    </div>
    <div class="right">
      <div>
        <span>日环比</span>
        <span class="num">{{ form.dailyBasis }}%</span>
      </div>
      <div>
        <span>上周同日</span>
        <span class="num">{{ form.lastWeekToday }}人</span>
      </div>
      <div>
        <span>上月同日</span>
        <span class="num">{{ form.lastMonthToday }}人</span>
      </div>
      <div>
        <span>上年同日</span>
        <span class="num">{{ form.lastYearToday }}人</span>
      </div>
    </div>
  </div>
</template>

<script>
import { PassengerFlowDailyBasis } from '@/api/large'

export default {
  name: 'flowStatistics',
  props: {
    shopId: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      form: {}
    }
  },
  watch: {
    // 监听统计组，请求日环比数据
    shopId(val) {
      this.getDailyBasis();
    }
  },
  methods: {
    /**
     * 时间：2024/12/10
     * 作者：刘岩
     * 功能：日环比
     */
    getDailyBasis() {
      PassengerFlowDailyBasis({
        regionId: this.shopId
      }).then(res => {
        this.form = res.data;
      });
    }
  }
}
</script>

<style scoped lang="scss">
.flow-statistics {
  width: 100%;
  flex: 1;
  display: flex;
  justify-content: space-between;
  .left {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    .left-img {
      width: 200px;
      padding: 10px 0 15px 0;
    }
    & > span {
      text-align: center;
      color: #ffffff;
      font-size: 16px;
    }
    .num {
      font-size: 24px;
      font-weight: bold;
    }
  }
  .right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    & > div {
      width: 200px;
      height: 34px;
      background: linear-gradient(270deg, rgba(30, 64, 99, .14), #1f4163);
      display: -ms-flexbox;
      display: flex;
      -ms-flex-align: center;
      align-items: center;
      -ms-flex-pack: justify;
      justify-content: space-between;
      padding-left: 12px;
      margin: 15px 0;
      & > span {
        color: #ffffff;
        font-size: 16px;
      }
      .num {
        font-weight: bold;
        font-size: 18px;
      }
    }
  }
}
</style>
